From: Dirkjan Ochtman Date: Thu, 29 Mar 2018 09:07:49 +0000 (+0200) Subject: Move resolver Context initialization into a method X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~114^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=050f4be86316ce274297b9daa118ee9cf527f08c;p=cargo.git Move resolver Context initialization into a method --- diff --git a/src/cargo/core/resolver/context.rs b/src/cargo/core/resolver/context.rs index 215a8a98c..eaf7036d9 100644 --- a/src/cargo/core/resolver/context.rs +++ b/src/cargo/core/resolver/context.rs @@ -37,6 +37,17 @@ pub struct Context { } impl Context { + pub fn new() -> Context { + Context { + resolve_graph: RcList::new(), + resolve_features: HashMap::new(), + links: HashMap::new(), + resolve_replacements: RcList::new(), + activations: HashMap::new(), + warnings: RcList::new(), + } + } + /// Activate this summary by inserting it into our list of known activations. /// /// Returns true if this summary with the given method is already activated. diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index e72439b14..3b71af2a7 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -63,7 +63,7 @@ use util::profile; use self::context::{Activations, Context}; use self::types::{ActivateError, ActivateResult, Candidate, ConflictReason, DepsFrame, GraphNode}; -use self::types::{RcList, RcVecIter, RegistryQueryer}; +use self::types::{RcVecIter, RegistryQueryer}; pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; pub use self::encode::{Metadata, WorkspaceResolve}; @@ -113,14 +113,7 @@ pub fn resolve( config: Option<&Config>, print_warnings: bool, ) -> CargoResult { - let cx = Context { - resolve_graph: RcList::new(), - resolve_features: HashMap::new(), - links: HashMap::new(), - resolve_replacements: RcList::new(), - activations: HashMap::new(), - warnings: RcList::new(), - }; + let cx = Context::new(); let _p = profile::start("resolving"); let minimal_versions = match config { Some(config) => config.cli_unstable().minimal_versions,